<!-- CREATED FOR A TOOL - DON'T EDIT!! -->

<templates>
	<types>
		<type id="System.String">string</type>
		<type id="System.Int32">int</type>
		<type id="System.Double">double</type>
		<type id="System.Int16">short</type>
		<type id="System.Int64">long</type>
		<type id="System.Single">float</type>
		<type id="System.Decimal">decimal</type>
		<type id="System.Boolean">bool</type>
		<type id="System.DateTime">DateTime</type>
		<type id="System.Byte[]">Blob</type>
		<type id="System.Guid">Guid</type>
		<type id="System.Byte">byte</type>
	</types>
	<initializes>
		<initialize id="System.String">string.Empty</initialize>
		<initialize id="System.Int16">0</initialize>
		<initialize id="System.Int32">0</initialize>
		<initialize id="System.Int64">0</initialize>
		<initialize id="System.Double">0</initialize>
		<initialize id="System.Single">0</initialize>
		<initialize id="System.Decimal">0</initialize>
		<initialize id="System.Boolean">false</initialize>
		<initialize id="System.DateTime">DateTime.Now</initialize>
		<initialize id="System.Byte[]">new Blob()</initialize>
		<initialize id="System.Guid">Guid.NewGuid()</initialize>
		<initialize id="System.Byte">0</initialize>
	</initializes>

	<methodTestRegion>
		<![CDATA[
		#region Method tests
		{0}
		
		#endregion
		]]>
	</methodTestRegion>

	<nullableTest>
		<![CDATA[
			// TODO: Verify the correctness of this test.
			val = null;
			target.{0} = val;
			Assert.AreEqual(val, target.{0}, "{1}.{2}.{0} was not set correctly.");
			]]>			
	</nullableTest>

	<methodOtherTest>
		<![CDATA[
		[Test]
		public void {2}()
		{0}
			{3} target = new {3}();

			{4} val = {5}; // TODO: Assign to an appropriate value for the property.
			target.{6} = val;
			Assert.AreEqual(val, target.{6}, "{7}.{3}.{6} was not set correctly.");
			{8}
			Assert.Fail("Verify the correctness of this test method.");
		{1}]]>
	</methodOtherTest>

	<methodStringTest>
		<![CDATA[
		[Test]
		public void {2}()
		{0}
			{3} target = new {3}();

			{4} val = {5}; // TODO: Assign to an appropriate value for the property.
			target.{6} = val;
			Assert.AreEqual(val, target.{6}, "{7}.{3}.{6} was not set correctly.");
			{10}
			// TODO: Verify the correctness of this test.
			val = new string('a', {8});
			try
			{0}
				target.{6} = val;
			{1}
			catch
			{0}
				Assert.Fail("{7}.{3}.{6} fired an exception, but should not: string to short to fire.");
			{1}
			
			// TODO: Verify the correctness of this test.
			val = new string('a', {9});
			try
			{0}
				target.{6} = val;
				Assert.Fail("{7}.{3}.{6} fired no exception, but should: string to long for the property.");
			{1}
			catch
			{0}
			{1}
			
			Assert.Fail("Verify the correctness of this test method.");
		{1}]]>
	</methodStringTest>

	<objectSetHolderTest>
		<![CDATA[
		[Test]
		public void {2}()
		{0}
			// TODO: Verify the correctness of this test.
			Assert.Fail("Verify the correctness of this test method.");

			{3} target = new {3}();
			{4} rp = {5}.CreateTestObjectInstance();
			
			target.{6}.Add(rp);
			
			ObjectContext context = null; // TODO: Assign to an appropriate value for the instance.
			context.StartTransaction();
			try
			{0}
				try
				{0}
					context.PersistChanges(target);
				{1}
				catch
				{0}
					Assert.Fail("Exception during persist of persistent object.");
				{1}
				
				{3} loaded = null; // TODO: Add code to load the object from the database: e.g. context.GetObject<{3}>("ID = ...");
				
				Assert.AreEqual(1, loaded.{6}.Count, "Reloaded amount of related objects does not match.");
				// TODO: Add assertion to make sure the reloaded object is the same as the saved one.
				// Assert.AreEqual(target.{6}[0].ID, loaded.{6}[0].ID, "Reloaded object is not the same as the saved one.");
			{1}
			finally
			{0}
				// Set all utility methods back to default.
				{5}.ResetUtilityMethods();
				ResetUtilityMethods();
				context.Rollback();
			{1}
		{1}]]>
	</objectSetHolderTest>

	<objectHolderTest>
		<![CDATA[
		[Test]
		public void {2}()
		{0}
			// TODO: Verify the correctness of this test.
			Assert.Fail("Verify the correctness of this test method.");

			{3} target = new {3}();
			{4} rp = {5}.CreateTestObjectInstance();
			
			target.{6} = rp;
			
			ObjectContext context = null; // TODO: Assign to an appropriate value for the instance.
			context.StartTransaction();
			try
			{0}
				try
				{0}
					context.PersistChanges(target);
				{1}
				catch
				{0}
					Assert.Fail("Exception during persist of persistent object.");
				{1}
				
				{3} loaded = null; // TODO: Add code to load the object from the database: e.g. context.GetObject<{3}>("ID = ...");
				
				Assert.IsTrue(loaded.{6} != null, "No related object found.");
				// TODO: Add assertion to make sure the reloaded object is the same as the saved one.
				// Assert.AreEqual(target.{6}[0].ID, loaded.{6}[0].ID, "Reloaded object is not the same as the saved one.");
			{1}
			finally
			{0}
				// Set all utility methods back to default.
				{5}.ResetUtilityMethods();
				ResetUtilityMethods();
				context.Rollback();
			{1}
		{1}]]>
	</objectHolderTest>

	<relationRegion>
		<![CDATA[
		#region Relation Tests
{0}

		#endregion
]]>
	</relationRegion>

	<createInstance>
		
		<instance>
			<![CDATA[{0} p = new {0}();
			{1}
			
			return p;]]>
		</instance>

		<setProperty>
			<![CDATA[
			p.{0} = {1};]]>
		</setProperty>

		<methodCalls>
			<call type="System.String">GetNextString({0})</call>
			<call type="System.Int32">GetNextInteger()</call>
			<call type="System.Double">GetNextDouble()</call>
			<call type="System.Int16">GetNextShort()</call>
			<call type="System.Int64">GetNextLong()</call>
			<call type="System.Single">GetNextFloat()</call>
			<call type="System.Decimal">GetNextDecimal()</call>
			<call type="System.Boolean">GetNextBool()</call>
			<call type="System.DateTime">GetNextDateTime()</call>
			<call type="System.Byte[]">new Blob(new byte[]{ 0, 0, 0, 0, 0});</call>
			<call type="System.Guid">new Guid.NewGuid()</call>
			<call type="System.Byte">0</call>
		</methodCalls>
		
	</createInstance>

	<persistentIOTest>
		<![CDATA[
		/// <summary>
		/// Tests the persistent's IO behavior.
		/// </summary>
		[Test]
		public void PersistentIOTest()
		{0}
			// TODO: Verify the correctness of this test.
			Assert.Fail("Verify the correctness of this test method.");
			
			ObjectContext context = null; // TODO: Assign to an appropriate value for the instance.
			context.StartTransaction();

			try
			{0}
				{2} target = CreateTestObjectInstance();
				// Save object.
				context.PersistChanges(target);

				// Load object.
				{2} rl1 = context.GetObject<{2}>({3});

{4}
				
				// Change the object and save it again.
				rl1.{5} = {6};
				context.PersistChanges(rl1);

				// Reload the object.
				{2} rl2 = context.GetObject<{2}>({3});

{7}
		
				// Mark object for deletion and delete it.
				context.MarkForDeletion(rl2);
				context.PersistChanges(rl2);

				// Try to reload the object.
				{2} rl3 = context.GetObject<{2}>({3});
				Assert.IsNull(rl3, "Deleted object has been reloaded.");
			{1}
			finally
			{0}
				// Set all utility methods back to default.
				ResetUtilityMethods();
				context.Rollback();
			{1}
		{1}
]]>
	</persistentIOTest>

	<assertAreEqual1>
		<![CDATA[				Assert.AreEqual(target.{0}, rl1.{0}, "Data corruption encountered in {1}.{2}.{0}");]]>
	</assertAreEqual1>

	<assertAreEqual2>
		<![CDATA[				Assert.AreEqual(rl1.{0}, rl2.{0}, "Data corruption encountered in {1}.{2}.{0}");]]>
	</assertAreEqual2>

	<unitTest>
		<![CDATA[#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using Chili.Opf3;
using NUnit.Framework;
using {7};

#endregion

namespace {2}
{0}
	[TestFixture]
	public sealed class {3}
	{0}
		#region Utility Methods

		private static Dictionary<int, string> _strings = new Dictionary<int, string>();
		private static int _integer;
		private static double _double;
		private static short _short;
		private static long _long;
		private static decimal _decimal;
		private static float _float;
		private static bool _bool;
		private static DateTime _dateTime = DateTime.Now;
		
		/// <summary>
		/// Resets the utility methods.
		/// </summary>
		public static void ResetUtilityMethods()
		{0}
			_strings = new Dictionary<int, string>();
			_integer = 0;
			_double = 0;
			_short = 0;
			_long = 0;
			_decimal = 0;
			_float = 0;
			_bool = false;
			_dateTime = DateTime.Now;
		{1}

		#region GetNextString

		/// <summary>
		/// Returns a string with the given Length.
		/// </summary>
		/// <param name="length">The length of the string.</param>
		public static string GetNextString(int length)
		{0}
			if (!_strings.ContainsKey(length))
				_strings.Add(length, InitializeString(length));

			// Return the next string.
			_strings[length] = IncrementString(0, _strings[length]);
			return _strings[length];
		{1}

		/// <summary>
		/// Initializes the string with a given length.
		/// </summary>
		private static string InitializeString(int length)
		{0}
			return new string('a', length);
		{1}

		/// <summary>
		/// Increment the string. 
		/// </summary>
		/// <param name="position">Position of the char to increment.</param>
		/// <param name="currentString">Current string value.</param>
		private static string IncrementString(int position, string currentString)
		{0}
			// Get the char at the given position.
			char c = currentString[position];

			bool recurse = false;
			// If we can increment the char - increment it.
			if ((int)c < 124)
			{0}
				// Don't use the upper case chars.
				if ((int)c == 64)
					c = (char)91;

				c = (char)(((int)c) + 1);
				recurse = false;
			{1}
			else
			{0}
				c = (char)33;
				recurse = true;
			{1}

			// Remove the char and add the new char.
			currentString = currentString.Remove(position, 1);
			currentString = currentString.Insert(position, c.ToString());

			// Return the string if we have not to recurse.
			if (!recurse)
				return currentString;

			// If we have no elements left throw an exception.
			if (position + 1 > currentString.Length)
				throw new InvalidOperationException("Attention: No chars left! No unique strings left!");

			// Recurse.
			return IncrementString(position + 1, currentString);
		{1}

		#endregion

		#region GetNextInteger

		/// <summary>
		/// Returns the next integer.
		/// </summary>
		public static int GetNextInteger()
		{0}
			if (_integer + 1 == int.MaxValue)
				throw new InvalidOperationException("Attention: No unique integer left!");
			
			_integer = (_integer += 1);
			return _integer;
		{1}

		#endregion

		#region GetNextDouble

		/// <summary>
		/// Returns the next double.
		/// </summary>
		public static double GetNextDouble()
		{0}
			if (_double + 1 == double.MaxValue)
				throw new InvalidOperationException("Attention: No unique double left!");
			
			_double = (_double += 0.1);
			return _double;
		{1}

		#endregion

		#region GetNextShort

		/// <summary>
		/// Returns the next short.
		/// </summary>
		public static short GetNextShort()
		{0}
			if (_short + 1 == short.MaxValue)
				throw new InvalidOperationException("Attention: No unique short left!");
			
			_short = (_short += 1);
			return _short;
		{1}

		#endregion

		#region GetNextLong

		/// <summary>
		/// Returns the next long.
		/// </summary>
		public static long GetNextLong()
		{0}
			if (_long + 1 == long.MaxValue)
				throw new InvalidOperationException("Attention: No unique long left!");
			
			_long = (_long += 1);
			return _long;
		{1}

		#endregion

		#region GetNextFloat

		/// <summary>
		/// Returns the next float.
		/// </summary>
		public static float GetNextFloat()
		{0}
			if (_float + 1 == float.MaxValue)
				throw new InvalidOperationException("Attention: No unique float left!");
			
			_float = (_float += 0.1F);
			return _float;
		{1}

		#endregion

		#region GetNextDecimal

		/// <summary>
		/// Returns the next decimal.
		/// </summary>
		public static decimal GetNextDecimal()
		{0}
			if (_decimal + 1 == decimal.MaxValue)
				throw new InvalidOperationException("Attention: No unique decimal left!");
			
			_decimal = (_decimal += (decimal)0.1);
			return _decimal;
		{1}

		#endregion

		#region GetNextBool

		/// <summary>
		/// Returns the next bool.
		/// </summary>
		public static bool GetNextBool()
		{0}
			_bool = !_bool;
			return _bool;
		{1}

		#endregion

		#region GetNextDateTime

		/// <summary>
		/// Returns the next DateTime.
		/// </summary>
		public static DateTime GetNextDateTime()
		{0}
			if (_dateTime.AddMinutes(-1) <= new DateTime(1900, 1, 1))
				throw new InvalidOperationException("Attention: No unique datetime left!");
			
			_dateTime = _dateTime.AddSeconds(-1);
			return _dateTime;
		{1}

		#endregion

		#endregion

		#region Additional test attributes

		//
		// You can use the following additional attributes as you write your tests:
		//
		// Use ClassInitialize to run code before running the first test in the class.
		// [TestFixtureSetUp]
		// public static void MyClassInitialize(TestContext testContext) 
		// {0} 
		// {1}
		//
		// Use ClassCleanup to run code after all tests in a class have run.
		// [TestFixtureTearDown]
		// public static void MyClassCleanup() 
		// {0} 
		// {1}
		//
		// Use TestInitialize to run code before running each test .
		// [SetUp]
		// public void MyTestInitialize() 
		// {0} 
		// {1}
		//
		// Use TestCleanup to run code after each test has run.
		// [TearDown]
		// public void MyTestCleanup() 
		// {0} 
		// {1}
		//
		
		#endregion
		{4}{6}{8}
		/// <summary>
		/// Creates an instance of the object to test.
		/// </summary>
		public static {9} CreateTestObjectInstance()
		{0}
			{5}
		{1}
	{1}
{1}
		]]>
	</unitTest>

</templates>